<?php
session_start();
require 'common/Utility.php';
require 'crud/CustomSecurity.class.php';
require 'crud/Categs_smetki.class.php';
require 'crud/Tsmetki.class.php';
require 'crud/Fuel.class.php';
require 'db/configuration.php';
require 'smetki/smetkiutil.php';
include_once("js/ajax/agent.php");
loginCheck();
loadDB();
setcookie("rynyty[lastpage]", "fuel.php", time()+60*60*24*30);
action();
date_default_timezone_set('GMT');
$agent->init();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html lang="bg">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="js/jcarousel/lib/jquery.jcarousel.css" />
<link rel="stylesheet" type="text/css" href="js/jcarousel/skins/tango/skin.css" />
<link rel="stylesheet" type="text/css" href="css/page.css" />
<link rel="stylesheet" type="text/css" href="css/date.css" />
<link rel="stylesheet" type="text/css" href="css/smetki.css" />
<link rel="stylesheet" type="text/css" href="js/charts/visualize.jQuery.css"/>
<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.2.5.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="http://visapi-gadgets.googlecode.com/svn/trunk/pilesofmoney/pom.css"/> 
 
<script type="text/javascript" src="http://visapi-gadgets.googlecode.com/svn/trunk/pilesofmoney/pom.js"></script>


<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.ui.core.js"></script>
<script type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="js/jedit/jquery.jeditable.mini.js"> </script>
<script type="text/javascript" src="js/jcarousel/lib/jquery.jcarousel.js"></script>
<!--[if IE]><script type="text/javascript" src="excanvas.compiled.js"></script><![endif]-->
<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.2.5.pack.js"></script>
<script type="text/javascript" src="js/charts/visualize.jQuery.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript" src="js/textevents.js"></script>
<script type="text/javascript" src="js/fuel.js"></script>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/debug.js"></script>
<script type="text/javascript" src="js/categories.js"></script>

<script type="text/javascript">
      google.load("visualization", "1", {packages:["piechart"]});
      google.load("visualization", "1");
      
</script>

<title>Гориво</title>
</head>
<body>

<?php include("common/lenta.php"); ?>

<div id="main">
	<div id="product-view">
			<div id="editnew-container"></div>
			<!--  <div id="logo"></div> -->
			<!-- <div id="logo-text"></div> -->
			<?php include("common/servizna-lenta.php"); ?>
			<script language="javascript" type="text/javascript" defer> 
	setSelected('fuel');	
	</script>
			<ul id="editnew">
				<li> 
					<input id="editbutton" type="button" value="редактиране" class="editnew" onclick="setEditMode();"></input>
				</li>
				<li><input id="find" type="text" name="find" onkeyup="filterSmetki();" /></li>
			</ul>
			<div id="top">
				<?php
				$categories = new Fuel(con());
				$listCategories = $categories->getEntries();
				$changeDate = "changeDate";
				pre_dump($listCategories);
				echo '<script language="javascript" type="text/javascript" defer> generateCategries_o('.json_encode($listCategories).', '.json_encode($listCategories[0][0]).', '.json_encode($changeDate).');</script>';
				?>
			</div>
			<div id="middle">
				<div class="left">
				<div id="hiddentable">
					<div id="spendingsChart"></div>
					<div id="balansChart"></div>
				</div>
				<input type="button" id="chart-button" onclick="show_hide_charts();">
				</div>
				<div class="content">
						
						<div id="form-container">
								<input id="datepicker" class="datepicker" name="date" type="text" value="<?=date('Y-m-j')?>"> 
								
								<input id="km" name="km" type="text" value="километри"
								onfocus="putStringOnTextFocus('km','километри');"
								onblur="putStringOnTextBlur('km','километри');"> 
								
								<input id="litres" name="litres" type="text" value="литри"
								onfocus="putStringOnTextFocus('litres','литри');"
								onblur="putStringOnTextBlur('litres','литри');"> 
								
								<input id="f_price" name="f_price" type="text" value="1.90"
								onfocus="putStringOnTextFocus('f_price','цена за литър');"
								onblur="putStringOnTextBlur('f_price','цена за литър');"> 
								
								<input id="comment" name="comment" type="text" value="допълнителен коментар"
								onfocus="putStringOnTextFocus('comment','допълнителен коментар');"
								onblur="putStringOnTextBlur('comment','допълнителен коментар');"> 
								
							<input type="button" value="добави" onclick="addLine();">
						</div>
						<div id="realcontent">
					
						</div>	
						<div id="balans">
						</div>
				</div>
			</div>
			<div id="bottom">
				<div class="bottomleft">
				</div>
				<div class="bottommiddle">
				</div>
				<div class="bottomright">
				
				</div>
			</div>
		</div>
</div>



<?php		
echo '<script language="javascript" type="text/javascript" defer> list_table_fuel('.json_encode(getLastEntriesByDate()).');</script>';
?> 	



<script type="text/javascript">
	$(function() {
		$(".datepicker").datepicker({ 
			dateFormat: 'yy-mm-dd', 
			firstDay: 1, 
			monthNames: ['Януари','Февруари','Март','Април','Май','Юни','Юли','Август','Септември','Октомври','Ноември','Декември'],
			dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб']});
	});
	</script>


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11565452-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();

</script>

<script type="text/javascript">
$(document).ready(function(){
	document.getElementById('hiddentable').style.display = 'none';
	
	resize();
	
	 });



</script>

</body>
</html>
